<!DOCTYPE html>
<html>
    <head>
        <title>web-messaging-rpc Example</title>
        <script src="lib/jquery.js">
        </script>
        <script type="text/javascript" src="../src/webrpc.js">
        </script>
        <script type="text/javascript">
            var sumService;
            $(function(){
                webrpc.load("sum.js", function(services, error){
                    sumService = services.sumService;
                    $("#sumButton").attr("disabled", false);
                });
            });
            function sum(){
                var num = parseInt($("#num").val(), 10);
                sumService.sum(num, function(result, error){
                    alert("Result is:" + result);
                })
            }
        </script>
    </head>
    <body>
        <h1>Sum Calculator</h1>
        Please input integer:<input type="text" id="num"><input id="sumButton" type="button" onclick="sum()" value="Sum" disabled>
    </body>
</html>
